<?php
class Model_Users
{
	/**
	 * @var MTxEntity\DAL\Entity\Repository\UsersRepository
	 */
	private $_repUsers;
	
	private $_em;
	
	public function __construct()
	{
		$this->_em = $em = Zend_Registry::get('em');
		$this->_repUsers = $em->getRepository('MTxEntity:Users');
	}
	
	/**
	 * Get list user
	 */
	public function getList()
	{
		$rst = array();
		try {
			$rst = $this->_repUsers->getList();
		} catch (Exception $ex) {
			throw $ex;
		}
		return $rst;
	}
	
	public function getView()
	{
		$rst = $this->_repUsers->getDataFromView();
		Zend_Debug::dump($rst);
	}
	
	public function test()
	{
		$user1	= $this->_em->find('MTxEntity:Users', 124);			//edit
	    $user1->setFirst_name('TEST TEST 111');
	    /*$this->_em->persist($user1);
	    $this->_em->flush();
    	$this->_em->getConnection()->commit();*/
    	$this->_em->clear();
	    $user2	= $this->_em->find('MTxEntity:Users', 124);			//edit
		echo $user2->getFirst_name();
	}
}